home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / kzr0597.zip / ARCOTH.CMD < prev    next >
OS/2 REXX Batch file  |  1997-03-10  |  3KB  |  84 lines

  1. /* REXX-Programm arcoth.CMD  */
  2.  
  3.    Call RxFuncAdd 'SysLoadFuncs', RexxUtil, 'SysLoadFuncs'
  4.    Call SysLoadFuncs
  5.    Signal on syntax name arcothMsg
  6.  
  7. /* Diese Variablen müssen für jede Prozedur definiert werden, damit die  */
  8. /* Prozedur die Variable bufND kennt und die Variable ND übernehmen kann.*/
  9.    Pfd=SysSearchPath("PATH", "kzr.cmd")
  10.    lp=LastPos("\", Pfd)
  11.    Pfd=DelStr(Pfd, 1+lp)
  12.    NDAarcoth=Pfd||"NDAarcoth.DAT"
  13.    bufND  =Pfd||"NDZahl.DAT"
  14.    bufMsg =Pfd||"Meldung.DAT"
  15.    ND = LineIn(bufND, 1)
  16.  
  17.    if ND > 400 then
  18.    do
  19.      ND=400
  20.      call charout(NDAarcoth) ; Call SysFileDelete NDAarcoth
  21.      ret=LineOut(NDAarcoth, 400)
  22.      Call Charout,"   Achtung, nur 400 Dezimalstellen bei der Berechnung von  arcoth(...)"
  23.      say
  24.      Beep(444, 200); Beep(628,300)  /* Hier kein EXIT ! */
  25.    end
  26.  
  27.    /* Wenn ND <= 400 ist, wird ND = ND  weitergegeben */
  28.    call charout(NDAarcoth) ; Call SysFileDelete NDAarcoth
  29.    ret=LineOut(NDAartanh, ND)
  30.  
  31.    arg x,y  /* y soll "illegale" Komma's im Funktions-Argument aufspüren */
  32.    p0p=x*x  /* Diese Anweisung prvoziert eine Syntax-Fehlermeldung       */
  33.  
  34.    if length(y) > 0 then
  35.    do
  36.      call charout(NDAarcoth); Call SysFileDelete NDAarcoth
  37.      ret=LineOut(bufMsg, "Im Argument von  arcoth(...)  ist mindestens  1  nicht zulässiges Komma !")
  38.      /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  39.      /*  damit in den diesbezüglichen temporären Dateien                      */
  40.      /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  41.      EXIT
  42.    end
  43.  
  44.    Numeric Digits ND+7
  45.  
  46.    if abs(x) = 1 then
  47.    do
  48.      call charout(NDAarcoth); Call SysFileDelete NDAarcoth
  49.      ret=LineOut(bufMsg, "Für  |x| = 1  ist  |arcoth(x)| = unendlich groß !")
  50.      /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  51.      /*  damit in den diesbezüglichen temporären Dateien                      */
  52.      /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  53.      EXIT
  54.    end
  55.  
  56.    if abs(x) < 1 then
  57.    do
  58.      call charout(NDAarcoth); Call SysFileDelete NDAarcoth
  59.      ret=LineOut(bufMsg, "Für  |x| < 1  hat  arcoth(x)  kein reelles Ergebnis !")
  60.      /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  61.      /*  damit in den diesbezüglichen temporären Dateien                      */
  62.      /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  63.      EXIT
  64.    end
  65.  
  66.    y=ln(sqrt((x+1)/(x-1)))
  67.  
  68.    /* Ausgabe */
  69. W: numeric digits ND
  70.    return(Format(y))
  71.  
  72. arcothMsg:
  73.    sf=ErrorText(RC)
  74.    if  Pos("Bad arithmetic conversion", sf) > 0 then
  75.    do
  76.      call charout(NDAarcoth); Call SysFileDelete NDAarcoth
  77.      ret=LineOut(bufMsg, "Sie haben in  arcoth(...)  kein gültiges Argument eingegeben !")
  78.   /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  79.   /*  damit in den diesbezüglichen temporären Dateien                      */
  80.   /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  81.      EXIT
  82.    end
  83.  
  84.